<template>
  <div id="weekend">
    <div class="weekend-title">周末去哪儿</div>
    <ul>
      <li class="item b-1px-b" v-for="item of weekUrlList" :key="item.id">
        <div class="item-img-wrapper">
          <img class="item-img" :src="item.imgUrl"/>
        </div>
        <div class="item-info">
          <p class="item-title">{{item.title}}</p>
          <p class="item-desc">{{item.desc}}</p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'Weekend',
  data () {
    return {
      weekUrlList: [
        {
          id: '01',
          imgUrl: require('images/weekends/weekend1.jpg'),
          title: '上海必打卡',
          desc: '中西合璧,现代和传统各有各的精彩'
        },
        {
          id: '02',
          imgUrl: require('images/weekends/weekend2.jpg'),
          title: '周末亲子爱玩',
          desc: '走进自然或玩转乐园,感知大千世界,游乐项目惊人的多'
        },
        {
          id: '03',
          imgUrl: require('images/weekends/weekend3.jpg'),
          title: '情迷博物馆',
          desc: '走进艺术殿堂,电影博物馆生动演绎电影人和电影故事'
        },
        {
          id: '04',
          imgUrl: require('images/weekends/weekend4.jpg'),
          title: '上海城市观光',
          desc: '来这里寻找你所不认识的魔都,感受云端漫步,品味人生'
        },
        {
          id: '05',
          imgUrl: require('images/weekends/weekend5.jpg'),
          title: '学生最爱TOP10',
          desc: '学习之余最爱玩耍,爱玩的你不可错过'
        }
      ]
    }
  }
}
</script>

<style lang="stylus" scoped>
  @import '~styles/mixins.styl'
  .weekend-title
    height: .8rem
    background: #eee
    line-height: .8rem
    /*padding-left: .2rem 等价于下面,首行缩进*/
    text-indent: .2rem
  .item
    /*
    display: flex
    flex-flow: column nowrap
    */
    overflow: hidden
    position: relative
    .item-wrapper
      width: 100%
      height: 0
      padding-bottom: 37.1%
    .item-img
      width: 100% /*1.重点,这里必须设置width:100%, 否则会等比例放大 */
      height: auto /*height可以忽略, 重点是width: 100%才能响应式,适合屏幕大小 */

      /*注意，设为Flex布局以后，子元素的float、clear和vertical-align属性将失效*/
    .item-info
      display: flex
      flex-flow: column nowrap
      justify-content: center
      height: 1.32rem
      text-indent: .2rem
      .item-title
        font-size: .32rem
        line-height: .4rem
        ellipsis()
      .item-desc
        color: #aaa
        line-height: .35rem
        ellipsis()
</style>
